package net.xiangcaowuyu.springcloud.alibaba.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * 博客：https://www.xiangcaowuyu.net
 * Description:
 *
 * @Author: 香草物语
 * DateTime: 2021-07-25 13:49
 */
@RestController
@Slf4j
public class NacosController {

    @Value("${server.port}")
    private String serverPort;

    @GetMapping(value = "/echo/{string}")
    public String echo(@PathVariable("string") String string) {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Hello Nacos Discovery " + string+"\t当前服务端口:"+serverPort;
    }

    @GetMapping(value = "app/echo/{string}")
    public String echo1(@PathVariable("string") String string) {
        return "app/echo/{string} " + string+"\t当前服务端口:"+serverPort;
    }

}
